<template>
	<view class="page">
		<view class="reward-history">
			<view class="list"  v-for="(item,key) in history_list" :key="key" v-if="item.goods_info.price !=0">
				<view class="left">
					<view class="title">微信红包</view>
					<view class="time">{{ utils.timeTodate('Y-m-d H:i', item.create_time*1000) }}</view>
				</view>
				<view class="right">{{item.goods_info.price}}</view>
			</view>
			<view class="" v-if="history_list.length == 0" style="text-align: center;padding: 50upx 0;">暂无记录</view>
		</view>
	</view>
</template>

<script>
	import utils from '@/components/shoyu-date/utils.filter.js';
	export default {
		data() {
			return {
				history_list:[],
				utils: utils
			}
		},
		onShow() {
			var self = this;
			self.$request.request({
				url:'/user/lottery/list',
				success:function(res){
					if(res.code==200){
						self.is_load = true;
						var  y = res.result;
						y.forEach((item,index)=>{
							y[index].goods_info.price = self.$money(item.goods_info.price)
						});
						self.history_list = y;
					}else if(res.code==40003){
						uni.navigateTo({
							url:"../login/login?page=reward-history"
						})
					}
				}
			});
			// #ifdef H5
			let share_time_line={
				title:self.$request.h5_share_name, // 分享标题
				link: self.$request.h5_share_url+'?page=index', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
				imgUrl: self.$request.h5_img_url+'/static/images/logo.png', // 分享图标
			}
			let share_app_message={
				title: self.$request.h5_share_name, // 分享标题
				desc: '我发现了一个很不错的商城，买家具有超大实惠！', // 分享描述
				link: self.$request.h5_share_url+'?page=index', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
				imgUrl: self.$request.h5_img_url+'/static/images/logo.png', // 分享图标
			}
			uni.setStorageSync('share_time_line',share_time_line);
			uni.setStorageSync('share_app_message',share_app_message);
			self.$request.wx_config()
			// #endif
		},
		onShareAppMessage(res) {
		    if (res.from === 'button') {
		      console.log(res.target)
		    }
		    return {
		      title: this.$request.share_title,
		      path: '/pages/index/index'
		    }
		  },
		methods: {
			
			
		}
	}
</script>

<style>
	@import url("reward-history");
</style>
